#! /usr/bin/env bash

bssid=$1
essid=$2
delay=$3
pause=$4

if [ -z "$bssid" ]
then
	echo Usage: $(basename $0) bssid [essid] [delay] [pause]
	exit
fi

if [ -z "$delay" ]
then
	delay=0
fi

if [ -z "$pause" ]
then
	pause=20
fi

cd "$(dirname "$0")"
cd ..

./script/kill.sh screen/crack-dictionary.pid
./script/kill.sh screen/crack-korek.pid
./script/kill.sh screen/crack-ptw.pid

echo $(date +"%Y-%m-%d %H:%M:%S") Cracking BSSID $bssid
./script/index.sh $bssid "$essid"

screen -S crack-dictionary.airobot-ng -d -m screen/crack-dictionary.sh $bssid "$essid" $delay $pause
screen -S crack-korek.airobot-ng -d -m screen/crack-korek.sh $bssid "$essid" $delay
screen -S crack-ptw.airobot-ng -d -m screen/crack-ptw.sh $bssid "$essid" $delay

